package core.domain.query.paging;

import java.util.List;

import core.domain.IdEntity;

public interface Pageable<T extends IdEntity> {

    /**
     * Get the content of current page
     * 
     * @return content of current page, empty list if current page exceeds max page number or is negative.
     */
    public List<T> content();

    /**
     * Get current page number
     * 
     * @return current page number
     */
    public int currentPage();

    /**
     * Get the number of pages stored in this Pageable object.
     * 
     * @return the number of pages
     */
    public int pageCount();

    /**
     * Get the page size of this Pageable object.
     * 
     * @return the size of page (always greater than or equal to the List size returned by Pageable#content()).
     * @see com.oocl.frm.tlquery.paging.Pageable#content()
     */
    public int pageSize();

    /**
     * Go to next page
     */
    public void next();

    /**
     * Go to previous page
     */
    public void prev();

    /**
     * Go to the page with absolute page number pageNum
     * 
     * @param pageNum
     * @throws IndexOutOfBoundsException when pageNum is greater than or equal to {@link Pageable#num()}
     */
    public void to(int pageNum) throws IndexOutOfBoundsException;

    /**
     * Return total count of the objects containing in Pageable.
     * 
     */
    public int totalSize();

    /**
     * Return the position of the first record in current page
     * 
     * @return
     */
    public int currentPos();
}
